<? if($data->tags): ?>
<div id="tags">
    <h2><span><?=dgettext('tag','Tags')?></span></h2>
    <div id="tagContainer">
        <? foreach($data->tags as $i): ?>
        <span class="tag<?=$i->match?' matched':''?>">
            <a class="name" href="/tag/<?=$i->tag?>"><?=$i->tag?></a>
            <a class="remove" href="javascript:addTag('<?=$i->ID?>');">+</a>
        </span>
        <? endforeach; ?>
    <div class="clear"></div>
    </div>
</div>
<script type="text/javascript">
    function addTag (ID){
        $('result').empty();
        tool.post({'url':'/json/tag/add','data':('ID='+ID),'onComplete':function(r){
           if(r.code == 200){

            } else tool.result(r.code,r.status,r.message,r.fields,r.redirect,r.debug);
        }});
    }
</script>
<?endif;?>